var app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    isLoading: !0,
    bannerArr: {
      picLink: []
    }
  },
  goReport() {
    wx.navigateTo({
      url: '/hyb_yl/mysubpages/pages/report/report',
    })
  },
  goCardList() {
    wx.showToast({
      title: '卡密功能待开放',
      icon: 'none',
    })
  },
  onLoad: function (options) {
    var that = this
    console.log(app)
    var tkid = app.globalData.tkid
    var mytkid = app.globalData.mytkid //上级
    wx.setNavigationBarTitle({
      title: options.tit
    })
    that.getBase()
    that.getCatefenlei()
    that.gettijianlist()
    var title = options.title
    wx.setNavigationBarTitle({
      title: title
    })
    var city = wx.getStorageSync('city')
    var bgc = wx.getStorageSync('color')
    wx.setNavigationBarColor({
      frontColor: "#ffffff",
      backgroundColor: bgc,
    })
    that.setData({
      city: city
    })
  },
  goDetail: function (e) {
    console.log(e)
    var that = this
    var tid = e.currentTarget.dataset.tid
    wx.navigateTo({
      url: 'detail/detail?tid=' + tid,
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },
  getCatefenlei() {
    var that = this
    app.util.request({
      'url': 'entry/wxapp/tijian.catefenlei',
      success: function (res) {
        console.log(res)
        that.setData({
          catefenlei: res.data,
          isLoading: !1
        })
      }
    })
  },
  gettijianlist() {
    var that = this
    app.util.request({
      'url': 'entry/wxapp/tijian.listall',
      success: function (res) {
        console.log(res)
        that.setData({
          packageList: res.data
        })
      }
    })
  },
  goHotSale(e) {
    var that = this
    var id = e.currentTarget.dataset.id
    wx.navigateTo({
      url: '/hyb_yl/userLife/pages/tijian/hot-sale/hot-sale?id=' + id
    })
  },
  getBase: function () {
    var that = this
    app.util.request({
      'url': 'entry/wxapp/index.adv',
      data:{
        position:3
      },
      success: function (res) {
        console.log(res)
        that.setData({
          tj_thumb: res.data,
        })
      },
      fail: function (err) {
        console.log(err)
      },
    })
  },
})